var detailVue = new Vue({
	el: "#app",
	data: {
		flag: true,
		nickname: "",
		birthday: "",
		area: "",
		income: "",
		hunyin: "",
		job: "",
		user: {}
	},
	methods: {
		upload: function(event) {
			var file = event.target.files;
			wx.showLoading({
				title: "上传中..."
			});
			var formData = new FormData();
			formData.append("file", file[0]);
			this.$http.post(baseUrl + "user/uploadImg", formData).then(function(e) {
				wx.hideLoading();
				var content = e.data;
				if (content.success) {
					this.user.avatar = imgUrl + content.data;
					localStorage.setItem("user_data", JSON.stringify(this.user));
				} else {
					wx.showToast({
						title: content.description,
						icon: "none",
						duration: 2e3,
						mask: !1
					});
				}
			});
		},
		addPicButton: function() {
			this.$refs.addPic.dispatchEvent(new MouseEvent('click'));
		},
		save: function() {
			wx.showLoading({
				title: "保存中..."
			});
			this.$http.post(baseUrl + "mjz/user/update/detail", {
				nickName: this.user.nickname,
				sex: this.flag?1:2,
				birthday: this.user.birthday,
				addr: this.user.addr,
				avatar: this.user.avatar
			}).then(function(e){
				wx.hideLoading();
				var d = e.data;
				if(!d.success){
					wx.showToast({
						title: d.description,
						icon: "none",
						duration: 1e3,
						mask: !0
					});
				}else{
					localStorage.setItem("user_data",JSON.stringify(this.user));
					wx.showToast({
						title: "保存修改成功!",
						icon: "none",
						duration: 1e3,
						mask: !0
					});
					setTimeout(function(){
						Jump.back();
					},1000)
				}
			})
		}
	},
	created: function() {
		var user_data = localStorage.getItem("user_data");
		this.user = JSON.parse(user_data);
	}
});
var addVue = detailVue;
